package com.wangqingbo.myspringbootproject.utils;

/**
 * 分页的工具类
 */
public class PageView {
    // 每页显示的数据条数，默认值设置为10
    private int pageSize = 10;
    // 当前页，默认值设置为1
    private int currentPage = 1;
    // 总记录数，到数据库中去查询
    private int recordCount;
    // 总页数
    private int pageCount;

    public PageView(){}

    public PageView(int pageSize,int currentPage,int recordCount)
    {
        this.pageSize = pageSize;
        this.currentPage = currentPage;
        this.recordCount = recordCount;
        // 计算总页数  也可以使用Math.ceil();方法来计算
        this.pageCount = (this.recordCount + this.pageSize - 1) / this.pageSize;

    }


    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(int currentPage) {
        this.currentPage = currentPage;
    }

    public int getRecordCount() {
        return recordCount;
    }

    public void setRecordCount(int recordCount) {
        this.recordCount = recordCount;
    }

    public int getPageCount() {
        return pageCount;
    }

    public void setPageCount(int pageCount) {
        this.pageCount = pageCount;
    }
}
